import { createRouter, createWebHistory, createWebHashHistory } from 'vue-router'
import home from '../views/HomePage.vue'

const router = createRouter({
  // history: createWebHistory(import.meta.env.BASE_URL),
  history: createWebHashHistory('/meeting-rj-web/'),
  routes: [
    {
      path: '/',
      name: '',
      component: home
    },

    // 1. 我的内容
    {
      path: '/my-content',
      name: 'myContent',
      component: () => import('../views/my_content/MyContent.vue')
    },
    {
      path: '/audio-page',
      name: 'AudioPage',
      component: () => import('../views/my_content/AudioPage.vue')
    },
    {
      path: '/video-page',
      name: 'VideoPage',
      component: () => import('../views/my_content/VideoPage.vue')
    },
    // 2.共享内容
    // {
    //   path: '/tablet',
    //   name: 'tablet',
    //   component: ()=>import(""),
    //   redirect:"/tablet/tablet-borrowed",
    //   children:[
    //     {
    //       path: 'tablet-borrowed',
    //       name: 'TabletBorrowed',
    //       component: TabletBorrowed,

    //     }
    //   ]
    // },
    // 3. 回收站
    {
      path: '/recycle',
      name: 'Recycle',
      component: () => import('../views/recycle_bin/RecyclePage.vue')
    },

    // hash设置默认路由
    {
      path: '/'
    }
  ]
})

//路由前置守卫
// router.beforeEach((to,from,next)=>{
//判断是否进入某个路径
//  if(to.path=="/"){
//     //可以进行路径重定向等
//     next({path:'tablet-borrowed'})
//  }else{
//     next()
//  }
// })

export default router
